package exedemo;

import java.util.Scanner;

//手机商品入库
public class Demo2_1 {
    public static void main(String[] args) {
        while(true){
            System.out.println("请输入商品数量,输入0退出");
            Scanner sc=new Scanner(System.in);
            int num=sc.nextInt();
            if(num==0){
                break;
            }
            System.out.println("请输入商品信息");
            PhoneGoods phone=inputGoods();
            printStorePhone(phone,num);
        }
    }
    public static PhoneGoods inputGoods(){
        PhoneGoods phone=null;
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入手机品牌");
        String brand=sc.next();
        System.out.println("请输入手机尺寸");
        double size=sc.nextDouble();
        System.out.println("请输入手机价格");
        double price=sc.nextDouble();
        System.out.println("请输入手机配置");
        String config=sc.next();
        phone=new PhoneGoods(brand,size,price,config);
        return phone;
    }
    public static void printStorePhone(PhoneGoods goods,int num){
        System.out.println("---------------入库清单-----------------");
        System.out.println("品牌："+goods.getBrand()+"，配置："+goods.getConfig()+"，尺寸："+goods.getSize()+"，单价："+goods.getPrice());
        System.out.println("入库数量"+num);
        System.out.println("总价值："+goods.getPrice()*num);
    }

}
